Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure how this is went unnoticed for so long, but the rotation of landed vessels created via
SpawnVessel
is completely bogus.With
heading
,pitch
androll
set to 0 my craft was spawned on the side with a seemingly random heading.At some point I tried to spawn a vessel with a clamp attached and it turned out to be very nice for debugging. Clamp allowed me to keep the rotation a given vessel was spawned with.
Anyway,
(0, 0, 0)
heading
,pitch
androll
before the fix:The main problem, turns out, was the incorrect order of operations:
rotation * normal
->normal * rotation
. Changing that fixed the(0, 0, 0)
case, but for non-zero it was still bogus.The original code made a distinction between spawned part, the SPH and the VAB, and I'm not sure that's a good thing. Let's say I have a pod in the default orientation in the VAB, in the SPH, or spawned from a single part. If I then specify
heading
etc as(h, p, r)
I expect the navball to point to(h, p, r)
when I switch to said pod. I find it more natural than rotating VAB vessels 90 degrees up. On the other hand if we don't do that, then VAB vessels will spawn on their bellies by default.For now I left the distinction and 90 degrees rotation for the VAB, so it shouldn't negatively affect legacy.